import axios from '@/plugins/axios'

// 结案报告相关API
export interface CaseReport {
  id?: number
  appointmentId: number
  studentId: number
  name: string
  gender: string
  department: string
  phone: string
  problemType: string
  totalSessions: number
  selfEvaluation: string
  createdAt?: string
}

// 创建结案报告并下载Word文档
export const createCaseReport = (data: any) => {
  return axios.post('/api/case-report', data, {
    responseType: 'blob' // 设置响应类型为blob以处理文件下载
  })
}

// 根据预约ID查询结案报告
export const getCaseReportByAppointmentId = (appointmentId: number) => {
  return axios.get(`/api/case-report/appointment/${appointmentId}`)
}

// 根据学生ID查询结案报告列表
export const getCaseReportsByStudentId = (studentId: number) => {
  return axios.get(`/api/case-report/student/${studentId}`)
}

// 根据咨询师ID查询结案报告列表
export const getCaseReportsByConsultantId = (consultantId: number) => {
  return axios.get(`/api/case-report/consultant/${consultantId}`)
}

// 更新结案报告
export const updateCaseReport = (data: CaseReport) => {
  return axios.put('/api/case-report', data)
}

// 删除结案报告
export const deleteCaseReport = (id: number) => {
  return axios.delete(`/api/case-report/${id}`)
}

// 获取所有结案报告
export const getAllCaseReports = () => {
  return axios.get('/api/case-report')
} 